home *** CD-ROM | disk | FTP | other *** search
- /**********************************************************************\
-
- File: main.c
-
- Purpose: This module handles the event loop and event dispatching.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program in a file named "GNU General Public License".
- If not, write to the Free Software Foundation, 675 Mass Ave,
- Cambridge, MA 02139, USA.
-
- \**********************************************************************/
-
- #include "main.h"
- #include "integrity.h"
- #include "environment.h"
- #include "error.h"
- #include "ssp.h"
- #include "program globals.h"
-
- void main(void)
- {
- Boolean programIntegrityVerified;
- Boolean programIntegritySet;
- short resultCode;
-
- /* do integrity check before anything else; see integrity.c for details */
- programIntegrityVerified=DoIntegrityCheck(&programIntegritySet);
-
- /* standard program initialization stuff */
- MaxApplZone();
- InitGraf(&thePort);
- InitFonts();
- FlushEvents(everyEvent, 0);
- InitWindows();
- InitMenus();
- TEInit();
- InitDialogs(0L);
- InitCursor();
- GetDateTime((unsigned long*)&randSeed);
-
- if ((resultCode=InitTheEnvironment())!=0) /* gestalt checks and variable initialization */
- HandleError(kSystemTooOld);
-
- if (!programIntegrityVerified) /* integrity check failed */
- HandleError(kProgramIntegrityNotVerified);
-
- if (programIntegritySet) /* integrity check freshly installed */
- HandleError(kProgramIntegritySet);
-
- if ((resultCode=DoSetup())!=allsWell)
- HandleError(resultCode);
-
- ExitToShell();
- }
-